<template>
  <div class="examine">
    <p class="p-title">
      {{ $store.state.examine.title }}
      <el-link
        style="float: right; padding-right: 50px;"
        :underline="false"
        :disabled="isLoading"
        type="primary"
        @click="updateWiki"
      >
        更新wiki库
      </el-link>
    </p>
    <router-view />
  </div>
</template>

<script>
import {
  updateWikiLib
} from '@/api/userProject';
export default {
  data() {
    return {
      isLoading: false
    };
  },
  methods: {
    updateWiki() {
      this.isLoading = true;
      const m = this.$message({
        message: '正在更新中...',
        offset: 40,
        duration: 0
      });
      updateWikiLib().then(() => {
        m.close();
        this.$message({
          message: '更新成功！',
          type: 'success',
          offset: 40
        });
      }).catch(() => {
        m.close();
        this.$message({
          message: '更新失败！',
          type: 'error',
          offset: 40
        });
      }).finally(() => {
        this.isLoading = false;
      });
    }
  }
};
</script>

<style lang="scss" scoped>
</style>
